From: Richard Muzik Date: Wed, 2 Jul 2025 05:40:43 +0000 (+0200) Subject: luci-app-lxc: make regex for templates less strict X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22http:/www.crowdsec.net/%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22?a=commitdiff_plain;h=7e7461542eee862a4bad2130d337934b663a27ec;p=project%2Fluci.git luci-app-lxc: make regex for templates less strict Starting with LXC v6.0.0, the way templates are parsed has changed [1]. As a result, trailing whitespace is added to each string except the last one. However, if the last string (i.e., a timestamp) is shorter—such as when using a different timestamp format—trailing whitespace will still be added. This commit updates the regular expression to handle such cases. [1] https://github.com/lxc/lxc/commit/84cc3155af502db586f644f1092831155e45ccca Signed-off-by: Richard Muzik --- diff --git a/applications/luci-app-lxc/luasrc/controller/lxc.lua b/applications/luci-app-lxc/luasrc/controller/lxc.lua index 5b603e52d9..c1777a03d1 100644 --- a/applications/luci-app-lxc/luasrc/controller/lxc.lua +++ b/applications/luci-app-lxc/luasrc/controller/lxc.lua @@ -61,7 +61,7 @@ function lxc_get_downloadable() %{ url }, 'r') local line for line in f:lines() do - local dist, version, dist_target = line:match("^(%S+)%s+(%S+)%s+(%S+)%s+default%s+%S+$") + local dist, version, dist_target = line:match("^(%S+)%s+(%S+)%s+(%S+)%s+default%s+(%S+)%s*$") if dist and version and dist_target and dist_target == target then templates[#templates+1] = "%s:%s" %{ dist, version } end